import sys
import json
import sys as s

def add(a,b):
	return a + b

result = {}
lastKey = False
for line123321 in sys.stdin:
	line123321 = line123321.strip()
	key = json.loads(line123321.split("\t")[0])
	value = json.loads(line123321.split("\t")[1])
	if lastKey and key !=lastKey:
		sys.stdout.write("%s\t%s\n" % (json.dumps(lastKey), json.dumps(result[lastKey])))
		lastKey = key
		result[key]=(add(result[key], value)) if (key in result ) else (value)
	else:
		lastKey = key
		result[key]=(add(result[key], value)) if (key in result ) else (value)
if lastKey:
	sys.stdout.write("%s\t%s\n" % (json.dumps(lastKey), json.dumps(result[lastKey])))
		
